'use strict';
const passwordHash = require('yi-password-hash');
const requireEx = require('yi-require');
const ObjectID = require('mongodb').ObjectID;

const middleware = (req, res, next) => {
    let authInfo =  req.context||req.context.authInfo ;
    if(!req.context || !req.context.authInfo){
        return res.err.unauthorized();
    }
    authInfo = authInfo.authInfo;

    req.body.userId = ObjectID(authInfo._id);
    next();
};

module.exports = {
    open : false,
    middleware: middleware,
    description:'新增霸屏信息',
    handler: requireEx('yi-restful').c('dominating',[])
};
